{% extends "edit/edit-base.html" %} 
{% block content %}
 <table class="table table-striped">
      <thead>
        <tr>
          <th>#</th>
          <th>标题</th>
          <th>分类</th>
          <th>时间</th>
          <th>类型</th>
          <th>@</th>
        </tr>
      </thead>
      <tbody>
      {% if blog_list %}
		{% for blog in blog_list %}
        <tr>
          <td><a href="{% url 'get_edit_blog' blog.id%}" TITLE="编辑该文章">{{blog.id}}</a></td>
          <td><a href="{% url 'get_edit_blog' blog.id%}" TITLE="编辑该文章">{{blog.title}}</a></td>
          <td>{{blog.classify.content }}</td>
          <td>{{ blog.time|date:"Y-m-d" }}</td>
          <td>{{ blog.type }}-{% ifequal blog.type 1%}原创{% endifequal %}{% ifequal blog.type 0%}转载{% endifequal %}{% ifequal blog.type 2%}翻译{% endifequal %}</td>
          <td class="delete"><a href="#" id="{{blog.id}}" TITLE="删除"><img  src="/images/delete.png" height="20" width="20"></a></td>
        </tr>
        {% endfor%}
        {%endif%}
      </tbody>
    </table>
    <!-- pagination -->
 	<nav>
        <ul class="pager">
        {% if blog_list.has_previous %}
          <li><a href="{{ query }}&pn={{ blog_list.previous_page_number}}">上一页</a></li>
        {% endif %}
		{% if blog_list.has_next %}
          <li><a href="{{ query }}&pn={{ blog_list.next_page_number}}">下一页</a></li>
        {% endif %}
        </ul>
    </nav>
<script type="text/javascript">
function deleteBlog(id){
	$.post("/edit/delete_blog/", {id:id}, function (result) { 
		if(result=="success"){
		//	alert("删除成功。。。");
			window.location.href='/edit/get_released_blog_list';
		}
	});
}
$(document).ready(function(){

	//发布文章
	  $(".delete a ").click(function(){
		var id = $(this).attr("id");
		if( confirm("确认删除当前文章。。。")){
			deleteBlog(id);
		}
	  });

		  
	});
</script>
{% endblock %}
